-/*\r
- * Copyright (c) 2002-2005, 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
- * 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
- *\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
- * 3) under the terms of the "GNU General Public License (GPL) Version 2" a \r
- * copy of which is in the file LICENSE3.txt in the root directory. The \r
- * license is also 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.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: dapl.h 1317 2005-04-25 17:29:42Z jlentini $\r
- **********************************************************************/\r
-\r
-#ifndef _DAPL_H_\r
-#define _DAPL_H_\r
-\r
-#if defined(__KERNEL__)\r
-#include <dat2/kdat.h>\r
-#else\r
-#include <dat2/udat.h>\r
-#endif /* defined(__KERNEL__) */\r
-#include <dat2/dat_registry.h>\r
-#include "dapl_osd.h"\r
-#include "dapl_debug.h"\r
-\r
-\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_SRQ = 0xC001Babe,\r
- DAPL_MAGIC_CR = 0xBe12Cee1,\r
- DAPL_MAGIC_CR_DESTROYED = 0xB12bDead,\r
- DAPL_MAGIC_CNO = 0xDeadF00d,\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
-#if defined (sun) || defined(__sun) || defined(_sun_) || defined (__solaris__) \r
-#define DAPL_BAD_PTR(a) ((unsigned long)(a) & 3)\r
-#elif defined(__linux__)\r
-#define DAPL_BAD_PTR(a) ((unsigned long)(a) & 3)\r
-#elif defined(_WIN64)\r
-#define DAPL_BAD_PTR(a) ((unsigned long)((DAT_UINT64)(a)) & 3)\r
-#elif defined(_WIN32)\r
-#define DAPL_BAD_PTR(a) ((unsigned long)((DAT_UINT64)(a)) & 3)\r
-#endif\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
-\r
-#define DAPL_BAD_HANDLE(h, magicNum) ( \\r
- ((h) == NULL) || \\r
- DAPL_BAD_PTR(h) || \\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_srq DAPL_SRQ;\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
-\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_COOKIE *pool;\r
- DAT_COUNT pool_size;\r
- DAPL_ATOMIC head;\r
- DAPL_ATOMIC tail;\r
-};\r
-\r
-#ifdef IBAPI\r
-#include "dapl_ibapi_util.h"\r
-#elif VAPI\r
-#include "dapl_vapi_util.h"\r
-#elif __OPENIB__\r
-#include "dapl_openib_util.h"\r
-#include "dapl_openib_cm.h"\r
-#elif DUMMY\r
-#include "dapl_dummy_util.h"\r
-#elif OPENIB\r
-#include "dapl_ib_util.h"\r
-#else /* windows - IBAL and/or IBAL+Sock_CM */\r
-#include "dapl_ibal_util.h"\r
-#endif\r
-\r
-struct dapl_hca\r
-{\r
- DAPL_OS_LOCK lock;\r
- DAPL_LLIST_HEAD ia_list_head; /* list of all open IAs */\r
- DAPL_ATOMIC handle_ref_count; /* count of ia_opens on handle */\r
- DAPL_EVD *async_evd;\r
- DAPL_EVD *async_error_evd;\r
- DAT_SOCK_ADDR6 hca_address; /* local address of HCA*/\r
- char *name; /* provider name */\r
- ib_hca_handle_t ib_hca_handle;\r
- unsigned long port_num; /* physical port number */\r
- ib_hca_transport_t ib_trans; /* Values specific transport API */\r
- /* Memory Subsystem Support */\r
- DAPL_HASH_TABLE *lmr_hash_table;\r
- /* Limits & useful HCA attributes */\r
- DAT_IA_ATTR ia_attr;\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
- DAPL_LLIST_HEAD srq_list_head; /* SRQ queue */\r
-#ifdef DAPL_COUNTERS\r
- void *cntrs;\r
-#endif\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
-#if defined(__KERNEL__)\r
- DAT_UPCALL_OBJECT cno_upcall;\r
- DAT_UPCALL_POLICY cno_upcall_policy;\r
-#else\r
- DAT_OS_WAIT_PROXY_AGENT cno_wait_agent;\r
-#endif /* defined(__KERNEL__) */\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
- /* 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
-\r
- DAT_COUNT cno_active_count;\r
- DAPL_CNO *cno_ptr;\r
-\r
- DAPL_OS_WAIT_OBJECT wait_object;\r
-\r
- DAT_COUNT threshold;\r
- DAPL_EVD_COMPLETION completion_type;\r
-\r
-#ifdef DAPL_COUNTERS\r
- void *cntrs;\r
-#endif\r
-};\r
-\r
-/* DAPL_PRIVATE used to pass private data in a connection */\r
-struct dapl_private\r
-{\r
-#ifdef IBHOSTS_NAMING\r
- DAT_SOCK_ADDR6 hca_address; /* local address of HCA*/\r
-#endif /* IBHOSTS_NAMING */\r
- unsigned char private_data[DAPL_MAX_PRIVATE_DATA_SIZE];\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) (uintptr_t);\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
- // dp_ib_cm_handle_t cm_handle;\r
-\r
- /* Add support for multiple CM object ownership */\r
- DAPL_LLIST_HEAD cm_list_head; \r
-\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
- DAPL_PRIVATE private;\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
-#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
-#if defined(_WIN32) || defined(_WIN64)\r
- DAT_BOOLEAN recv_discreq;\r
- DAT_BOOLEAN sent_discreq;\r
-#endif\r
-#ifdef DAPL_COUNTERS\r
- void *cntrs;\r
-#endif\r
-};\r
-\r
-/* DAPL_SRQ maps to DAT_SRQ_HANDLE */\r
-struct dapl_srq\r
-{\r
- DAPL_HEADER header;\r
- DAT_SRQ_PARAM param;\r
- DAPL_ATOMIC srq_ref_count;\r
- DAPL_COOKIE_BUFFER recv_buffer;\r
- DAPL_ATOMIC recv_count;\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
-#if !defined(__KDAPL__)\r
- char shmid[DAT_LMR_COOKIE_SIZE]; /* shared memory ID */\r
- ib_shm_transport_t ib_trans; /* provider specific data */\r
-#endif /* !__KDAPL__ */\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_CONN_QUAL conn_qual;\r
- DAT_EVD_HANDLE evd_handle;\r
- DAT_PSP_FLAGS psp_flags;\r
- DAT_EP_HANDLE ep_handle;\r
-\r
- /* maintenence fields */\r
- DAT_BOOLEAN listening; /* PSP is registered & active */\r
- ib_cm_srvc_handle_t cm_srvc_handle; /* Used by Mellanox CM */\r
- DAPL_LLIST_HEAD cr_list_head; /* CR pending queue */\r
- DAT_COUNT cr_list_count; /* count of CRs on queue */\r
-#if defined(_VENDOR_IBAL_)\r
- DAPL_OS_WAIT_OBJECT wait_object; /* cancel & destroy. */\r
-#endif\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
- dp_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
-#ifdef DAT_EXTENSIONS\r
- DAPL_DTO_TYPE_EXTENSION,\r
-#endif\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
-/*\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 IBHOSTS_NAMING\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
-{\r
- uint32_t ip_address;\r
- ib_gid_t gid;\r
-} DAPL_GID_MAP;\r
-\r
-#endif /* IBHOSTS_NAMING */\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
-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
- * 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
-#if !defined(__KERNEL__)\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
-extern DAT_RETURN DAT_API dapl_cno_fd_create (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- OUT DAT_FD *, /* file_descriptor */\r
- OUT DAT_CNO_HANDLE *); /* cno_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_cno_trigger (\r
- IN DAT_CNO_HANDLE, /* cno_handle */\r
- OUT DAT_EVD_HANDLE *); /* evd_handle */\r
-\r
-#endif /* !defined(__KERNEL__) */\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, /* cr_handle */\r
- IN DAT_COUNT, /* private_data_size */\r
- IN const DAT_PVOID ); /* private_data */\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
-#if defined(__KERNEL__)\r
-extern DAT_RETURN DAT_API dapl_ia_memtype_hint (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_MEM_TYPE, /* mem_type */\r
- IN DAT_VLEN, /* length */\r
- IN DAT_MEM_OPT, /* mem_optimization */\r
- OUT DAT_VLEN *, /* suggested_length */\r
- OUT DAT_VADDR *); /* suggested_alignment */\r
-\r
-extern DAT_RETURN DAT_API dapl_evd_kcreate (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_COUNT, /* evd_min_qlen */\r
- IN DAT_UPCALL_POLICY, /* upcall_policy */\r
- IN const DAT_UPCALL_OBJECT *, /* upcall */\r
- IN DAT_EVD_FLAGS, /* evd_flags */\r
- OUT DAT_EVD_HANDLE * ); /* evd_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_evd_kquery (\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
-#else\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
-#endif /* defined(__KERNEL__) */\r
-\r
-#if defined(__KERNEL__)\r
-extern DAT_RETURN DAT_API dapl_evd_modify_upcall (\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- IN DAT_UPCALL_POLICY, /* upcall_policy */\r
- IN const DAT_UPCALL_OBJECT * ); /* upcall */\r
-\r
-#else\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
-#endif\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
-#if !defined(__KERNEL__)\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
-#endif /* !defined(__KERNEL__) */\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_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_common_connect (\r
- IN DAT_EP_HANDLE ep, /* ep_handle */\r
- IN DAT_IA_ADDRESS_PTR remote_addr, /* remote_ia_address */\r
- IN DAT_TIMEOUT timeout, /* timeout */\r
- IN DAT_COUNT pdata_size, /* private_data_size */\r
- IN const DAT_PVOID pdata ); /* private_data */\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 ); /* close_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_read_to_rmr (\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN const DAT_RMR_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_post_send_with_invalidate (\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
- IN DAT_BOOLEAN, /* invalidate_flag */\r
- IN DAT_RMR_CONTEXT); /* RMR context */\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
-extern DAT_RETURN DAT_API dapl_ep_create_with_srq (\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 DAT_SRQ_HANDLE, /* srq_handle */\r
- IN const DAT_EP_ATTR *, /* ep_attributes */\r
- OUT DAT_EP_HANDLE *); /* ep_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_ep_recv_query (\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- OUT DAT_COUNT *, /* nbufs_allocated */\r
- OUT DAT_COUNT *); /* bufs_alloc_span */\r
-\r
-extern DAT_RETURN DAT_API dapl_ep_set_watermark (\r
- IN DAT_EP_HANDLE, /* ep_handle */\r
- IN DAT_COUNT, /* soft_high_watermark */\r
- IN DAT_COUNT); /* hard_high_watermark */\r
-\r
-/* LMR functions */\r
-\r
-#if defined(__KERNEL__)\r
-extern DAT_RETURN DAT_API dapl_lmr_kcreate (\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_VA_TYPE, /* va_type */\r
- IN DAT_MEM_OPT, /* optimization */\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
-#else\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
- IN DAT_VA_TYPE, /* va_type */\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
-#endif /* defined(__KERNEL__) */\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
-extern DAT_RETURN DAT_API dapl_lmr_sync_rdma_read (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN const DAT_LMR_TRIPLET *, /* local_segments */\r
- IN DAT_VLEN); /* num_segments */\r
-\r
-extern DAT_RETURN DAT_API dapl_lmr_sync_rdma_write (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN const DAT_LMR_TRIPLET *, /* local_segments */\r
- IN DAT_VLEN); /* num_segments */\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_create_for_ep (\r
- IN DAT_PZ_HANDLE pz_handle, /* pz_handle */\r
- OUT DAT_RMR_HANDLE *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 DAT_LMR_HANDLE, /* lmr_handle */\r
- IN const DAT_LMR_TRIPLET *, /* lmr_triplet */\r
- IN DAT_MEM_PRIV_FLAGS, /* mem_priv */\r
- IN DAT_VA_TYPE, /* va_type */\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
-/* SRQ functions */\r
-\r
-extern DAT_RETURN DAT_API dapl_srq_create (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_PZ_HANDLE, /* pz_handle */\r
- IN DAT_SRQ_ATTR *, /* srq_attr */\r
- OUT DAT_SRQ_HANDLE *); /* srq_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_srq_free (\r
- IN DAT_SRQ_HANDLE); /* srq_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_srq_post_recv (\r
- IN DAT_SRQ_HANDLE, /* srq_handle */\r
- IN DAT_COUNT, /* num_segments */\r
- IN DAT_LMR_TRIPLET *, /* local_iov */\r
- IN DAT_DTO_COOKIE); /* user_cookie */\r
-\r
-extern DAT_RETURN DAT_API dapl_srq_query (\r
- IN DAT_SRQ_HANDLE, /* srq_handle */\r
- IN DAT_SRQ_PARAM_MASK, /* srq_param_mask */\r
- OUT DAT_SRQ_PARAM *); /* srq_param */\r
-\r
-extern DAT_RETURN DAT_API dapl_srq_resize (\r
- IN DAT_SRQ_HANDLE, /* srq_handle */\r
- IN DAT_COUNT); /* srq_max_recv_dto */\r
-\r
-extern DAT_RETURN DAT_API dapl_srq_set_lw (\r
- IN DAT_SRQ_HANDLE, /* srq_handle */\r
- IN DAT_COUNT); /* low_watermark */\r
-\r
-/* CSP functions */\r
-extern DAT_RETURN DAT_API dapl_csp_create (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN DAT_COMM *, /* communicator */\r
- IN DAT_IA_ADDRESS_PTR, /* address */\r
- IN DAT_EVD_HANDLE, /* evd_handle */\r
- OUT DAT_CSP_HANDLE *); /* csp_handle */\r
-\r
-extern DAT_RETURN DAT_API dapl_csp_query (\r
- IN DAT_CSP_HANDLE, /* csp_handle */\r
- IN DAT_CSP_PARAM_MASK, /* csp_param_mask */\r
- OUT DAT_CSP_PARAM *); /* csp_param */\r
-\r
-extern DAT_RETURN DAT_API dapl_csp_free (\r
- IN DAT_CSP_HANDLE); /* csp_handle */\r
-\r
-/* HA functions */\r
-DAT_RETURN DAT_API dapl_ia_ha (\r
- IN DAT_IA_HANDLE, /* ia_handle */\r
- IN const DAT_NAME_PTR, /* provider */\r
- OUT DAT_BOOLEAN *); /* answer */\r
-\r
-#ifdef DAT_EXTENSIONS\r
-#include <stdarg.h>\r
-extern DAT_RETURN DAT_API dapl_extensions (\r
- IN DAT_HANDLE, /* handle */\r
- IN DAT_EXTENDED_OP, /* extended op */\r
- IN va_list); /* argument list */\r
-#endif\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\r
+/*
+ * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
+ *
+ * This Software is licensed under one of the following licenses:
+ *
+ * 1) under the terms of the "Common Public License 1.0" a copy of which is
+ * in the file LICENSE.txt in the root directory. The license is also
+ * available from the Open Source Initiative, see
+ * http://www.opensource.org/licenses/cpl.php.
+ *
+ * 2) under the terms of the "The BSD License" a copy of which is in the file
+ * LICENSE2.txt in the root directory. The license is also available from
+ * the Open Source Initiative, see
+ * http://www.opensource.org/licenses/bsd-license.php.
+ *
+ * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
+ * copy of which is in the file LICENSE3.txt in the root directory. The
+ * license is also available from the Open Source Initiative, see
+ * http://www.opensource.org/licenses/gpl-license.php.
+ *
+ * Licensee has the right to choose one of the above licenses.
+ *
+ * Redistributions of source code must retain the above copyright
+ * notice and one of the license notices.
+ *
+ * Redistributions in binary form must reproduce both the above copyright
+ * notice, one of the license notices in the documentation
+ * and/or other materials provided with the distribution.
+ */
+
+/**********************************************************************
+ *
+ * MODULE: dapl.h
+ *
+ * PURPOSE: defines common data structures for the DAPL reference implemenation
+ *
+ * Description: This file describes the working data structures used within
+ * DAPL RI.
+ *
+ *
+ * $Id: dapl.h 1317 2005-04-25 17:29:42Z jlentini $
+ **********************************************************************/
+
+#ifndef _DAPL_H_
+#define _DAPL_H_
+
+#if defined(__KERNEL__)
+#include <dat2/kdat.h>
+#else
+#include <dat2/udat.h>
+#endif /* defined(__KERNEL__) */
+#include <dat2/dat_registry.h>
+#include "dapl_osd.h"
+#include "dapl_debug.h"
+
+
+
+/*********************************************************************
+ * *
+ * Enumerations *
+ * *
+ *********************************************************************/
+
+typedef enum dapl_magic
+{
+ /* magic number values for verification & debug */
+ DAPL_MAGIC_IA = 0xCafeF00d,
+ DAPL_MAGIC_EVD = 0xFeedFace,
+ DAPL_MAGIC_EP = 0xDeadBabe,
+ DAPL_MAGIC_LMR = 0xBeefCafe,
+ DAPL_MAGIC_RMR = 0xABadCafe,
+ DAPL_MAGIC_PZ = 0xDeafBeef,
+ DAPL_MAGIC_PSP = 0xBeadeD0c,
+ DAPL_MAGIC_RSP = 0xFab4Feed,
+ DAPL_MAGIC_SRQ = 0xC001Babe,
+ DAPL_MAGIC_CR = 0xBe12Cee1,
+ DAPL_MAGIC_CR_DESTROYED = 0xB12bDead,
+ DAPL_MAGIC_CNO = 0xDeadF00d,
+ DAPL_MAGIC_INVALID = 0xFFFFFFFF
+} DAPL_MAGIC;
+
+typedef enum dapl_evd_state
+{
+ DAPL_EVD_STATE_TERMINAL,
+ DAPL_EVD_STATE_INITIAL,
+ DAPL_EVD_STATE_OPEN,
+ DAPL_EVD_STATE_WAITED,
+ DAPL_EVD_STATE_DEAD = 0xDEAD
+} DAPL_EVD_STATE;
+
+typedef enum dapl_evd_completion
+{
+ DAPL_EVD_STATE_INIT,
+ DAPL_EVD_STATE_SOLICITED_WAIT,
+ DAPL_EVD_STATE_THRESHOLD,
+ DAPL_EVD_STATE_UNSIGNALLED
+} DAPL_EVD_COMPLETION;
+
+typedef enum dapl_cno_state
+{
+ DAPL_CNO_STATE_UNTRIGGERED,
+ DAPL_CNO_STATE_TRIGGERED,
+ DAPL_CNO_STATE_DEAD = 0xDeadFeed,
+} DAPL_CNO_STATE;
+
+typedef enum dapl_qp_state
+{
+ DAPL_QP_STATE_UNCONNECTED,
+ DAPL_QP_STATE_RESERVED,
+ DAPL_QP_STATE_PASSIVE_CONNECTION_PENDING,
+ DAPL_QP_STATE_ACTIVE_CONNECTION_PENDING,
+ DAPL_QP_STATE_TENTATIVE_CONNECTION_PENDING,
+ DAPL_QP_STATE_CONNECTED,
+ DAPL_QP_STATE_DISCONNECT_PENDING,
+ DAPL_QP_STATE_ERROR,
+ DAPL_QP_STATE_NOT_REUSABLE,
+ DAPL_QP_STATE_FREE
+} DAPL_QP_STATE;
+
+
+/*********************************************************************
+ * *
+ * Constants *
+ * *
+ *********************************************************************/
+
+/*
+ * number of HCAs allowed
+ */
+#define DAPL_MAX_HCA_COUNT 4
+
+/*
+ * Configures the RMR bind evd restriction
+ */
+
+#define DAPL_RMR_BIND_EVD_RESTRICTION DAT_RMR_EVD_SAME_AS_REQUEST_EVD
+
+/*
+ * special qp_state indicating the EP does not have a QP attached yet
+ */
+#define DAPL_QP_STATE_UNATTACHED 0xFFF0
+
+#define DAPL_MAX_PRIVATE_DATA_SIZE 256
+
+/*********************************************************************
+ * *
+ * Macros *
+ * *
+ *********************************************************************/
+
+#if defined (sun) || defined(__sun) || defined(_sun_) || defined (__solaris__)
+#define DAPL_BAD_PTR(a) ((unsigned long)(a) & 3)
+#elif defined(__linux__)
+#define DAPL_BAD_PTR(a) ((unsigned long)(a) & 3)
+#elif defined(_WIN64)
+#define DAPL_BAD_PTR(a) ((unsigned long)((DAT_UINT64)(a)) & 3)
+#elif defined(_WIN32)
+#define DAPL_BAD_PTR(a) ((unsigned long)((DAT_UINT64)(a)) & 3)
+#endif
+
+/*
+ * Simple macro to verify a handle is bad. Conditions:
+ * - pointer is NULL
+ * - pointer is not word aligned
+ * - pointer's magic number is wrong
+ */
+
+#define DAPL_BAD_HANDLE(h, magicNum) ( \
+ ((h) == NULL) || \
+ DAPL_BAD_PTR(h) || \
+ (((DAPL_HEADER *)(h))->magic != (magicNum)))
+
+#define DAPL_MIN(a, b) ((a < b) ? (a) : (b))
+#define DAPL_MAX(a, b) ((a > b) ? (a) : (b))
+
+#if NDEBUG > 0
+#define DEBUG_IS_BAD_HANDLE(h, magicNum) (DAPL_BAD_HANDLE(h, magicNum))
+#else
+#define DEBUG_IS_BAD_HANDLE(h, magicNum) (0)
+#endif
+
+#define DAT_ERROR(Type, SubType) ((DAT_RETURN)(DAT_CLASS_ERROR | Type | SubType))
+
+/*********************************************************************
+ * *
+ * Typedefs *
+ * *
+ *********************************************************************/
+
+typedef struct dapl_llist_entry DAPL_LLIST_ENTRY;
+typedef DAPL_LLIST_ENTRY * DAPL_LLIST_HEAD;
+typedef struct dapl_ring_buffer DAPL_RING_BUFFER;
+typedef struct dapl_cookie_buffer DAPL_COOKIE_BUFFER;
+
+typedef struct dapl_hash_table DAPL_HASH_TABLE;
+typedef struct dapl_hash_table * DAPL_HASH_TABLEP;
+typedef DAT_UINT64 DAPL_HASH_KEY;
+typedef void * DAPL_HASH_DATA;
+
+typedef struct dapl_hca DAPL_HCA;
+
+typedef struct dapl_header DAPL_HEADER;
+
+typedef struct dapl_ia DAPL_IA;
+typedef struct dapl_cno DAPL_CNO;
+typedef struct dapl_evd DAPL_EVD;
+typedef struct dapl_ep DAPL_EP;
+typedef struct dapl_srq DAPL_SRQ;
+typedef struct dapl_pz DAPL_PZ;
+typedef struct dapl_lmr DAPL_LMR;
+typedef struct dapl_rmr DAPL_RMR;
+typedef struct dapl_sp DAPL_SP;
+typedef struct dapl_cr DAPL_CR;
+
+typedef struct dapl_cookie DAPL_COOKIE;
+typedef struct dapl_dto_cookie DAPL_DTO_COOKIE;
+typedef struct dapl_rmr_cookie DAPL_RMR_COOKIE;
+
+typedef struct dapl_private DAPL_PRIVATE;
+
+
+
+/*********************************************************************
+ * *
+ * Structures *
+ * *
+ *********************************************************************/
+
+struct dapl_llist_entry
+{
+ struct dapl_llist_entry *flink;
+ struct dapl_llist_entry *blink;
+ void *data;
+ DAPL_LLIST_HEAD *list_head; /* for consistency checking */
+};
+
+struct dapl_ring_buffer
+{
+ void **base; /* base of element array */
+ DAT_COUNT lim; /* mask, number of entries - 1 */
+ DAPL_ATOMIC head; /* head pointer index */
+ DAPL_ATOMIC tail; /* tail pointer index */
+};
+
+struct dapl_cookie_buffer
+{
+ DAPL_COOKIE *pool;
+ DAT_COUNT pool_size;
+ DAPL_ATOMIC head;
+ DAPL_ATOMIC tail;
+};
+
+#ifdef IBAPI
+#include "dapl_ibapi_util.h"
+#elif VAPI
+#include "dapl_vapi_util.h"
+#elif __OPENIB__
+#include "dapl_openib_util.h"
+#include "dapl_openib_cm.h"
+#elif DUMMY
+#include "dapl_dummy_util.h"
+#elif OPENIB
+#include "dapl_ib_util.h"
+#else /* windows - IBAL and/or IBAL+Sock_CM */
+#include "dapl_ibal_util.h"
+#endif
+
+struct dapl_hca
+{
+ DAPL_OS_LOCK lock;
+ DAPL_LLIST_HEAD ia_list_head; /* list of all open IAs */
+ DAPL_ATOMIC handle_ref_count; /* count of ia_opens on handle */
+ DAPL_EVD *async_evd;
+ DAPL_EVD *async_error_evd;
+ DAT_SOCK_ADDR6 hca_address; /* local address of HCA*/
+ char *name; /* provider name */
+ ib_hca_handle_t ib_hca_handle;
+ unsigned long port_num; /* physical port number */
+ ib_hca_transport_t ib_trans; /* Values specific transport API */
+ /* Memory Subsystem Support */
+ DAPL_HASH_TABLE *lmr_hash_table;
+ /* Limits & useful HCA attributes */
+ DAT_IA_ATTR ia_attr;
+};
+
+/* DAPL Objects always have the following header */
+struct dapl_header
+{
+ DAT_PROVIDER *provider; /* required by DAT - must be first */
+ DAPL_MAGIC magic; /* magic number for verification */
+ DAT_HANDLE_TYPE handle_type; /* struct type */
+ DAPL_IA *owner_ia; /* ia which owns this stuct */
+ DAPL_LLIST_ENTRY ia_list_entry; /* link entry on ia struct */
+ DAT_CONTEXT user_context; /* user context - opaque to DAPL */
+ DAPL_OS_LOCK lock; /* lock - in header for easier macros */
+};
+
+/* DAPL_IA maps to DAT_IA_HANDLE */
+struct dapl_ia
+{
+ DAPL_HEADER header;
+ DAPL_HCA *hca_ptr;
+ DAPL_EVD *async_error_evd;
+ DAT_BOOLEAN cleanup_async_error_evd;
+
+ DAPL_LLIST_ENTRY hca_ia_list_entry; /* HCAs list of IAs */
+ DAPL_LLIST_HEAD ep_list_head; /* EP queue */
+ DAPL_LLIST_HEAD lmr_list_head; /* LMR queue */
+ DAPL_LLIST_HEAD rmr_list_head; /* RMR queue */
+ DAPL_LLIST_HEAD pz_list_head; /* PZ queue */
+ DAPL_LLIST_HEAD evd_list_head; /* EVD queue */
+ DAPL_LLIST_HEAD cno_list_head; /* CNO queue */
+ DAPL_LLIST_HEAD psp_list_head; /* PSP queue */
+ DAPL_LLIST_HEAD rsp_list_head; /* RSP queue */
+ DAPL_LLIST_HEAD srq_list_head; /* SRQ queue */
+#ifdef DAPL_COUNTERS
+ void *cntrs;
+#endif
+};
+
+/* DAPL_CNO maps to DAT_CNO_HANDLE */
+struct dapl_cno
+{
+ DAPL_HEADER header;
+
+ /* A CNO cannot be freed while it is referenced elsewhere. */
+ DAPL_ATOMIC cno_ref_count;
+ DAPL_CNO_STATE cno_state;
+
+ DAT_COUNT cno_waiters;
+ DAPL_EVD *cno_evd_triggered;
+#if defined(__KERNEL__)
+ DAT_UPCALL_OBJECT cno_upcall;
+ DAT_UPCALL_POLICY cno_upcall_policy;
+#else
+ DAT_OS_WAIT_PROXY_AGENT cno_wait_agent;
+#endif /* defined(__KERNEL__) */
+
+ DAPL_OS_WAIT_OBJECT cno_wait_object;
+};
+
+/* DAPL_EVD maps to DAT_EVD_HANDLE */
+struct dapl_evd
+{
+ DAPL_HEADER header;
+
+ DAPL_EVD_STATE evd_state;
+ DAT_EVD_FLAGS evd_flags;
+ DAT_BOOLEAN evd_enabled; /* For attached CNO. */
+ DAT_BOOLEAN evd_waitable; /* EVD state. */
+
+ /* Derived from evd_flags; see dapls_evd_internal_create. */
+ DAT_BOOLEAN evd_producer_locking_needed;
+
+ /* Every EVD has a CQ unless it is a SOFTWARE_EVENT only EVD */
+ ib_cq_handle_t ib_cq_handle;
+
+ /* An Event Dispatcher cannot be freed while
+ * it is referenced elsewhere.
+ */
+ DAPL_ATOMIC evd_ref_count;
+
+ /* Set if there has been a catastrophic overflow */
+ DAT_BOOLEAN catastrophic_overflow;
+
+ /* the actual events */
+ DAT_COUNT qlen;
+ DAT_EVENT *events;
+ DAPL_RING_BUFFER free_event_queue;
+ DAPL_RING_BUFFER pending_event_queue;
+
+ /* CQ Completions are not placed into 'deferred_events'
+ ** rather they are simply left on the Completion Queue
+ ** and the fact that there was a notification is flagged.
+ */
+ DAT_BOOLEAN cq_notified;
+ DAPL_OS_TICKS cq_notified_when;
+
+ DAT_COUNT cno_active_count;
+ DAPL_CNO *cno_ptr;
+
+ DAPL_OS_WAIT_OBJECT wait_object;
+
+ DAT_COUNT threshold;
+ DAPL_EVD_COMPLETION completion_type;
+
+#ifdef DAPL_COUNTERS
+ void *cntrs;
+#endif
+};
+
+/* DAPL_PRIVATE used to pass private data in a connection */
+struct dapl_private
+{
+#ifdef IBHOSTS_NAMING
+ DAT_SOCK_ADDR6 hca_address; /* local address of HCA*/
+#endif /* IBHOSTS_NAMING */
+ unsigned char private_data[DAPL_MAX_PRIVATE_DATA_SIZE];
+};
+
+/* uDAPL timer entry, used to queue timeouts */
+struct dapl_timer_entry
+{
+ DAPL_LLIST_ENTRY list_entry; /* link entry on ia struct */
+ DAPL_OS_TIMEVAL expires;
+ void (*function) (uintptr_t);
+ void *data;
+};
+
+#ifdef DAPL_DBG_IO_TRC
+
+#define DBG_IO_TRC_QLEN 32 /* length of trace buffer */
+#define DBG_IO_TRC_IOV 3 /* iov elements we keep track of */
+
+struct io_buf_track
+{
+ Ib_send_op_type op_type;
+ DAPL_COOKIE *cookie;
+ DAT_LMR_TRIPLET iov[DBG_IO_TRC_IOV];
+ DAT_RMR_TRIPLET remote_iov;
+ unsigned int done; /* count to track completion ordering */
+ int status;
+ void *wqe;
+};
+
+#endif /* DAPL_DBG_IO_TRC */
+
+/* DAPL_EP maps to DAT_EP_HANDLE */
+struct dapl_ep
+{
+ DAPL_HEADER header;
+ /* What the DAT Consumer asked for */
+ DAT_EP_PARAM param;
+
+ /* The RC Queue Pair (IBM OS API) */
+ ib_qp_handle_t qp_handle;
+ unsigned int qpn; /* qp number */
+ ib_qp_state_t qp_state;
+
+ /* communications manager handle (IBM OS API) */
+ // dp_ib_cm_handle_t cm_handle;
+
+ /* Add support for multiple CM object ownership */
+ DAPL_LLIST_HEAD cm_list_head;
+
+ /* store the remote IA address here, reference from the param
+ * struct which only has a pointer, no storage
+ */
+ DAT_SOCK_ADDR6 remote_ia_address;
+
+ /* For passive connections we maintain a back pointer to the CR */
+ void * cr_ptr;
+
+ /* pointer to connection timer, if set */
+ struct dapl_timer_entry *cxn_timer;
+
+ /* private data container */
+ DAPL_PRIVATE private;
+
+ /* DTO data */
+ DAPL_ATOMIC req_count;
+ DAPL_ATOMIC recv_count;
+
+ DAPL_COOKIE_BUFFER req_buffer;
+ DAPL_COOKIE_BUFFER recv_buffer;
+
+#ifdef DAPL_DBG_IO_TRC
+ int ibt_dumped;
+ struct io_buf_track *ibt_base;
+ DAPL_RING_BUFFER ibt_queue;
+#endif /* DAPL_DBG_IO_TRC */
+#if defined(_WIN32) || defined(_WIN64)
+ DAT_BOOLEAN recv_discreq;
+ DAT_BOOLEAN sent_discreq;
+ dp_ib_cm_handle_t ibal_cm_handle;
+#endif
+#ifdef DAPL_COUNTERS
+ void *cntrs;
+#endif
+};
+
+/* DAPL_SRQ maps to DAT_SRQ_HANDLE */
+struct dapl_srq
+{
+ DAPL_HEADER header;
+ DAT_SRQ_PARAM param;
+ DAPL_ATOMIC srq_ref_count;
+ DAPL_COOKIE_BUFFER recv_buffer;
+ DAPL_ATOMIC recv_count;
+};
+
+/* DAPL_PZ maps to DAT_PZ_HANDLE */
+struct dapl_pz
+{
+ DAPL_HEADER header;
+ ib_pd_handle_t pd_handle;
+ DAPL_ATOMIC pz_ref_count;
+};
+
+/* DAPL_LMR maps to DAT_LMR_HANDLE */
+struct dapl_lmr
+{
+ DAPL_HEADER header;
+ DAT_LMR_PARAM param;
+ ib_mr_handle_t mr_handle;
+ DAPL_ATOMIC lmr_ref_count;
+#if !defined(__KDAPL__)
+ char shmid[DAT_LMR_COOKIE_SIZE]; /* shared memory ID */
+ ib_shm_transport_t ib_trans; /* provider specific data */
+#endif /* !__KDAPL__ */
+};
+
+/* DAPL_RMR maps to DAT_RMR_HANDLE */
+struct dapl_rmr
+{
+ DAPL_HEADER header;
+ DAT_RMR_PARAM param;
+ DAPL_EP *ep;
+ DAPL_PZ *pz;
+ DAPL_LMR *lmr;
+ ib_mw_handle_t mw_handle;
+};
+
+/* SP types, indicating the state and queue */
+typedef enum dapl_sp_state
+{
+ DAPL_SP_STATE_FREE,
+ DAPL_SP_STATE_PSP_LISTENING,
+ DAPL_SP_STATE_PSP_PENDING,
+ DAPL_SP_STATE_RSP_LISTENING,
+ DAPL_SP_STATE_RSP_PENDING
+} DAPL_SP_STATE;
+
+/* DAPL_SP maps to DAT_PSP_HANDLE and DAT_RSP_HANDLE */
+struct dapl_sp
+{
+ DAPL_HEADER header;
+ DAPL_SP_STATE state; /* type and queue of the SP */
+
+ /* PSP/RSP PARAM fields */
+ DAT_CONN_QUAL conn_qual;
+ DAT_EVD_HANDLE evd_handle;
+ DAT_PSP_FLAGS psp_flags;
+ DAT_EP_HANDLE ep_handle;
+
+ /* maintenence fields */
+ DAT_BOOLEAN listening; /* PSP is registered & active */
+ ib_cm_srvc_handle_t cm_srvc_handle; /* Used by Mellanox CM */
+ DAPL_LLIST_HEAD cr_list_head; /* CR pending queue */
+ DAT_COUNT cr_list_count; /* count of CRs on queue */
+#if defined(_VENDOR_IBAL_)
+ DAPL_OS_WAIT_OBJECT wait_object; /* cancel & destroy. */
+#endif
+};
+
+/* DAPL_CR maps to DAT_CR_HANDLE */
+struct dapl_cr
+{
+ DAPL_HEADER header;
+
+ /* for convenience the data is kept as a DAT_CR_PARAM.
+ * however, the "local_endpoint" field is always NULL
+ * so this wastes a pointer. This is probably ok to
+ * simplify code, espedially dat_cr_query.
+ */
+ DAT_CR_PARAM param;
+ /* IB specific fields */
+ dp_ib_cm_handle_t ib_cm_handle;
+
+ DAT_SOCK_ADDR6 remote_ia_address;
+ /* Assuming that the maximum private data size is small.
+ * If it gets large, use of a pointer may be appropriate.
+ */
+ unsigned char private_data[DAPL_MAX_PRIVATE_DATA_SIZE];
+ /*
+ * Need to be able to associate the CR back to the PSP for
+ * dapl_cr_reject.
+ */
+ DAPL_SP *sp_ptr;
+};
+
+typedef enum dapl_dto_type
+{
+ DAPL_DTO_TYPE_SEND,
+ DAPL_DTO_TYPE_RECV,
+ DAPL_DTO_TYPE_RDMA_WRITE,
+ DAPL_DTO_TYPE_RDMA_READ,
+#ifdef DAT_EXTENSIONS
+ DAPL_DTO_TYPE_EXTENSION,
+#endif
+} DAPL_DTO_TYPE;
+
+typedef enum dapl_cookie_type
+{
+ DAPL_COOKIE_TYPE_NULL,
+ DAPL_COOKIE_TYPE_DTO,
+ DAPL_COOKIE_TYPE_RMR,
+} DAPL_COOKIE_TYPE;
+
+/* DAPL_DTO_COOKIE used as context for DTO WQEs */
+struct dapl_dto_cookie
+{
+ DAPL_DTO_TYPE type;
+ DAT_DTO_COOKIE cookie;
+ DAT_COUNT size; /* used for SEND and RDMA write */
+};
+
+/* DAPL_RMR_COOKIE used as context for bind WQEs */
+struct dapl_rmr_cookie
+{
+ DAPL_RMR *rmr;
+ DAT_RMR_COOKIE cookie;
+};
+
+/* DAPL_COOKIE used as context for WQEs */
+struct dapl_cookie
+{
+ DAPL_COOKIE_TYPE type; /* Must be first, to define struct. */
+ DAPL_EP *ep;
+ DAT_COUNT index;
+ union
+ {
+ DAPL_DTO_COOKIE dto;
+ DAPL_RMR_COOKIE rmr;
+ } val;
+};
+
+/*
+ * Private Data operations. Used to obtain the size of the private
+ * data from the provider layer.
+ */
+typedef enum dapl_private_data_op
+{
+ DAPL_PDATA_CONN_REQ = 0, /* connect request */
+ DAPL_PDATA_CONN_REP = 1, /* connect reply */
+ DAPL_PDATA_CONN_REJ = 2, /* connect reject */
+ DAPL_PDATA_CONN_DREQ = 3, /* disconnect request */
+ DAPL_PDATA_CONN_DREP = 4, /* disconnect reply */
+} DAPL_PDATA_OP;
+
+
+/*
+ * Generic HCA name field
+ */
+#define DAPL_HCA_NAME_MAX_LEN 260
+typedef char DAPL_HCA_NAME[DAPL_HCA_NAME_MAX_LEN+1];
+
+#ifdef IBHOSTS_NAMING
+
+/*
+ * Simple mapping table to match IP addresses to GIDs. Loaded
+ * by dapl_init.
+ */
+typedef struct _dapl_gid_map_table
+{
+ uint32_t ip_address;
+ ib_gid_t gid;
+} DAPL_GID_MAP;
+
+#endif /* IBHOSTS_NAMING */
+
+/*
+ * IBTA defined reason for reject message: See IBTA 1.1 specification,
+ * 12.6.7.2 REJECTION REASON section.
+ */
+#define IB_CM_REJ_REASON_CONSUMER_REJ 0x001C
+
+
+#if defined(DAPL_DBG_IO_TRC)
+/*********************************************************************
+ * *
+ * Debug I/O tracing support prototypes *
+ * *
+ *********************************************************************/
+/*
+ * I/O tracing support
+ */
+void dapls_io_trc_alloc (
+ DAPL_EP *ep_ptr);
+
+void dapls_io_trc_update_completion (
+ DAPL_EP *ep_ptr,
+ DAPL_COOKIE *cookie,
+ ib_uint32_t ib_status );
+
+void dapls_io_trc_dump (
+ DAPL_EP *ep_ptr,
+ ib_work_completion_t *cqe_ptr,
+ ib_uint32_t ib_status);
+
+#else /* DAPL_DBG_IO_TRC */
+
+#define dapls_io_trc_alloc(a)
+#define dapls_io_trc_update_completion(a, b, c)
+#define dapls_io_trc_dump(a, b, c)
+
+#endif /* DAPL_DBG_IO_TRC */
+
+
+/*********************************************************************
+ * *
+ * Function Prototypes *
+ * *
+ *********************************************************************/
+
+typedef void (*DAPL_CONNECTION_STATE_HANDLER) (
+ IN DAPL_EP *,
+ IN ib_cm_events_t,
+ IN const void *,
+ OUT DAT_EVENT *);
+
+/*
+ * DAT Mandated functions
+ */
+
+extern DAT_RETURN DAT_API dapl_ia_open (
+ IN const DAT_NAME_PTR, /* name */
+ IN DAT_COUNT, /* asynch_evd_qlen */
+ INOUT DAT_EVD_HANDLE *, /* asynch_evd_handle */
+ OUT DAT_IA_HANDLE *); /* ia_handle */
+
+extern DAT_RETURN DAT_API dapl_ia_close (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN DAT_CLOSE_FLAGS ); /* ia_flags */
+
+
+extern DAT_RETURN DAT_API dapl_ia_query (
+ IN DAT_IA_HANDLE, /* ia handle */
+ OUT DAT_EVD_HANDLE *, /* async_evd_handle */
+ IN DAT_IA_ATTR_MASK, /* ia_params_mask */
+ OUT DAT_IA_ATTR *, /* ia_params */
+ IN DAT_PROVIDER_ATTR_MASK, /* provider_params_mask */
+ OUT DAT_PROVIDER_ATTR * ); /* provider_params */
+
+
+/* helper functions */
+
+extern DAT_RETURN DAT_API dapl_set_consumer_context (
+ IN DAT_HANDLE, /* dat handle */
+ IN DAT_CONTEXT); /* context */
+
+extern DAT_RETURN DAT_API dapl_get_consumer_context (
+ IN DAT_HANDLE, /* dat handle */
+ OUT DAT_CONTEXT * ); /* context */
+
+extern DAT_RETURN DAT_API dapl_get_handle_type (
+ IN DAT_HANDLE,
+ OUT DAT_HANDLE_TYPE * );
+
+/* CNO functions */
+
+#if !defined(__KERNEL__)
+extern DAT_RETURN DAT_API dapl_cno_create (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN DAT_OS_WAIT_PROXY_AGENT, /* agent */
+ OUT DAT_CNO_HANDLE *); /* cno_handle */
+
+extern DAT_RETURN DAT_API dapl_cno_modify_agent (
+ IN DAT_CNO_HANDLE, /* cno_handle */
+ IN DAT_OS_WAIT_PROXY_AGENT); /* agent */
+
+extern DAT_RETURN DAT_API dapl_cno_query (
+ IN DAT_CNO_HANDLE, /* cno_handle */
+ IN DAT_CNO_PARAM_MASK, /* cno_param_mask */
+ OUT DAT_CNO_PARAM * ); /* cno_param */
+
+extern DAT_RETURN DAT_API dapl_cno_free (
+ IN DAT_CNO_HANDLE); /* cno_handle */
+
+extern DAT_RETURN DAT_API dapl_cno_wait (
+ IN DAT_CNO_HANDLE, /* cno_handle */
+ IN DAT_TIMEOUT, /* timeout */
+ OUT DAT_EVD_HANDLE *); /* evd_handle */
+
+extern DAT_RETURN DAT_API dapl_cno_fd_create (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ OUT DAT_FD *, /* file_descriptor */
+ OUT DAT_CNO_HANDLE *); /* cno_handle */
+
+extern DAT_RETURN DAT_API dapl_cno_trigger (
+ IN DAT_CNO_HANDLE, /* cno_handle */
+ OUT DAT_EVD_HANDLE *); /* evd_handle */
+
+#endif /* !defined(__KERNEL__) */
+
+/* CR Functions */
+
+extern DAT_RETURN DAT_API dapl_cr_query (
+ IN DAT_CR_HANDLE, /* cr_handle */
+ IN DAT_CR_PARAM_MASK, /* cr_args_mask */
+ OUT DAT_CR_PARAM * ); /* cwr_args */
+
+extern DAT_RETURN DAT_API dapl_cr_accept (
+ IN DAT_CR_HANDLE, /* cr_handle */
+ IN DAT_EP_HANDLE, /* ep_handle */
+ IN DAT_COUNT, /* private_data_size */
+ IN const DAT_PVOID ); /* private_data */
+
+extern DAT_RETURN DAT_API dapl_cr_reject (
+ IN DAT_CR_HANDLE, /* cr_handle */
+ IN DAT_COUNT, /* private_data_size */
+ IN const DAT_PVOID ); /* private_data */
+
+extern DAT_RETURN DAT_API dapl_cr_handoff (
+ IN DAT_CR_HANDLE, /* cr_handle */
+ IN DAT_CONN_QUAL); /* handoff */
+
+/* EVD Functions */
+
+#if defined(__KERNEL__)
+extern DAT_RETURN DAT_API dapl_ia_memtype_hint (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN DAT_MEM_TYPE, /* mem_type */
+ IN DAT_VLEN, /* length */
+ IN DAT_MEM_OPT, /* mem_optimization */
+ OUT DAT_VLEN *, /* suggested_length */
+ OUT DAT_VADDR *); /* suggested_alignment */
+
+extern DAT_RETURN DAT_API dapl_evd_kcreate (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN DAT_COUNT, /* evd_min_qlen */
+ IN DAT_UPCALL_POLICY, /* upcall_policy */
+ IN const DAT_UPCALL_OBJECT *, /* upcall */
+ IN DAT_EVD_FLAGS, /* evd_flags */
+ OUT DAT_EVD_HANDLE * ); /* evd_handle */
+
+extern DAT_RETURN DAT_API dapl_evd_kquery (
+ IN DAT_EVD_HANDLE, /* evd_handle */
+ IN DAT_EVD_PARAM_MASK, /* evd_args_mask */
+ OUT DAT_EVD_PARAM * ); /* evd_args */
+
+#else
+extern DAT_RETURN DAT_API dapl_evd_create (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN DAT_COUNT, /* evd_min_qlen */
+ IN DAT_CNO_HANDLE, /* cno_handle */
+ IN DAT_EVD_FLAGS, /* evd_flags */
+ OUT DAT_EVD_HANDLE * ); /* evd_handle */
+
+extern DAT_RETURN DAT_API dapl_evd_query (
+ IN DAT_EVD_HANDLE, /* evd_handle */
+ IN DAT_EVD_PARAM_MASK, /* evd_args_mask */
+ OUT DAT_EVD_PARAM * ); /* evd_args */
+#endif /* defined(__KERNEL__) */
+
+#if defined(__KERNEL__)
+extern DAT_RETURN DAT_API dapl_evd_modify_upcall (
+ IN DAT_EVD_HANDLE, /* evd_handle */
+ IN DAT_UPCALL_POLICY, /* upcall_policy */
+ IN const DAT_UPCALL_OBJECT * ); /* upcall */
+
+#else
+
+extern DAT_RETURN DAT_API dapl_evd_modify_cno (
+ IN DAT_EVD_HANDLE, /* evd_handle */
+ IN DAT_CNO_HANDLE); /* cno_handle */
+#endif
+
+extern DAT_RETURN DAT_API dapl_evd_enable (
+ IN DAT_EVD_HANDLE); /* evd_handle */
+
+extern DAT_RETURN DAT_API dapl_evd_disable (
+ IN DAT_EVD_HANDLE); /* evd_handle */
+
+#if !defined(__KERNEL__)
+extern DAT_RETURN DAT_API dapl_evd_wait (
+ IN DAT_EVD_HANDLE, /* evd_handle */
+ IN DAT_TIMEOUT, /* timeout */
+ IN DAT_COUNT, /* threshold */
+ OUT DAT_EVENT *, /* event */
+ OUT DAT_COUNT *); /* nmore */
+#endif /* !defined(__KERNEL__) */
+
+extern DAT_RETURN DAT_API dapl_evd_resize (
+ IN DAT_EVD_HANDLE, /* evd_handle */
+ IN DAT_COUNT ); /* evd_qlen */
+
+extern DAT_RETURN DAT_API dapl_evd_post_se (
+ DAT_EVD_HANDLE, /* evd_handle */
+ const DAT_EVENT * ); /* event */
+
+extern DAT_RETURN DAT_API dapl_evd_dequeue (
+ IN DAT_EVD_HANDLE, /* evd_handle */
+ OUT DAT_EVENT * ); /* event */
+
+extern DAT_RETURN DAT_API dapl_evd_free (
+ IN DAT_EVD_HANDLE );
+
+extern DAT_RETURN DAT_API
+dapl_evd_set_unwaitable (
+ IN DAT_EVD_HANDLE evd_handle );
+
+extern DAT_RETURN DAT_API
+dapl_evd_clear_unwaitable (
+ IN DAT_EVD_HANDLE evd_handle );
+
+/* EP functions */
+
+extern DAT_RETURN DAT_API dapl_ep_create (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN DAT_PZ_HANDLE, /* pz_handle */
+ IN DAT_EVD_HANDLE, /* in_dto_completion_evd_handle */
+ IN DAT_EVD_HANDLE, /* out_dto_completion_evd_handle */
+ IN DAT_EVD_HANDLE, /* connect_evd_handle */
+ IN const DAT_EP_ATTR *, /* ep_parameters */
+ OUT DAT_EP_HANDLE * ); /* ep_handle */
+
+extern DAT_RETURN DAT_API dapl_ep_query (
+ IN DAT_EP_HANDLE, /* ep_handle */
+ IN DAT_EP_PARAM_MASK, /* ep_args_mask */
+ OUT DAT_EP_PARAM * ); /* ep_args */
+
+extern DAT_RETURN DAT_API dapl_ep_modify (
+ IN DAT_EP_HANDLE, /* ep_handle */
+ IN DAT_EP_PARAM_MASK, /* ep_args_mask */
+ IN const DAT_EP_PARAM * ); /* ep_args */
+
+extern DAT_RETURN DAT_API dapl_ep_connect (
+ IN DAT_EP_HANDLE, /* ep_handle */
+ IN DAT_IA_ADDRESS_PTR, /* remote_ia_address */
+ IN DAT_CONN_QUAL, /* remote_conn_qual */
+ IN DAT_TIMEOUT, /* timeout */
+ IN DAT_COUNT, /* private_data_size */
+ IN const DAT_PVOID, /* private_data */
+ IN DAT_QOS, /* quality_of_service */
+ IN DAT_CONNECT_FLAGS ); /* connect_flags */
+
+extern DAT_RETURN DAT_API dapl_ep_common_connect (
+ IN DAT_EP_HANDLE ep, /* ep_handle */
+ IN DAT_IA_ADDRESS_PTR remote_addr, /* remote_ia_address */
+ IN DAT_TIMEOUT timeout, /* timeout */
+ IN DAT_COUNT pdata_size, /* private_data_size */
+ IN const DAT_PVOID pdata ); /* private_data */
+
+extern DAT_RETURN DAT_API dapl_ep_dup_connect (
+ IN DAT_EP_HANDLE, /* ep_handle */
+ IN DAT_EP_HANDLE, /* ep_dup_handle */
+ IN DAT_TIMEOUT, /* timeout*/
+ IN DAT_COUNT, /* private_data_size */
+ IN const DAT_PVOID, /* private_data */
+ IN DAT_QOS); /* quality_of_service */
+
+extern DAT_RETURN DAT_API dapl_ep_disconnect (
+ IN DAT_EP_HANDLE, /* ep_handle */
+ IN DAT_CLOSE_FLAGS ); /* close_flags */
+
+extern DAT_RETURN DAT_API dapl_ep_post_send (
+ IN DAT_EP_HANDLE, /* ep_handle */
+ IN DAT_COUNT, /* num_segments */
+ IN DAT_LMR_TRIPLET *, /* local_iov */
+ IN DAT_DTO_COOKIE, /* user_cookie */
+ IN DAT_COMPLETION_FLAGS ); /* completion_flags */
+
+extern DAT_RETURN DAT_API dapl_ep_post_recv (
+ IN DAT_EP_HANDLE, /* ep_handle */
+ IN DAT_COUNT, /* num_segments */
+ IN DAT_LMR_TRIPLET *, /* local_iov */
+ IN DAT_DTO_COOKIE, /* user_cookie */
+ IN DAT_COMPLETION_FLAGS ); /* completion_flags */
+
+extern DAT_RETURN DAT_API dapl_ep_post_rdma_read (
+ IN DAT_EP_HANDLE, /* ep_handle */
+ IN DAT_COUNT, /* num_segments */
+ IN DAT_LMR_TRIPLET *, /* local_iov */
+ IN DAT_DTO_COOKIE, /* user_cookie */
+ IN const DAT_RMR_TRIPLET *, /* remote_iov */
+ IN DAT_COMPLETION_FLAGS ); /* completion_flags */
+
+extern DAT_RETURN DAT_API dapl_ep_post_rdma_read_to_rmr (
+ IN DAT_EP_HANDLE, /* ep_handle */
+ IN const DAT_RMR_TRIPLET *,/* local_iov */
+ IN DAT_DTO_COOKIE, /* user_cookie */
+ IN const DAT_RMR_TRIPLET *,/* remote_iov */
+ IN DAT_COMPLETION_FLAGS); /* completion_flags */
+
+extern DAT_RETURN DAT_API dapl_ep_post_rdma_write (
+ IN DAT_EP_HANDLE, /* ep_handle */
+ IN DAT_COUNT, /* num_segments */
+ IN DAT_LMR_TRIPLET *, /* local_iov */
+ IN DAT_DTO_COOKIE, /* user_cookie */
+ IN const DAT_RMR_TRIPLET *, /* remote_iov */
+ IN DAT_COMPLETION_FLAGS ); /* completion_flags */
+
+extern DAT_RETURN DAT_API dapl_ep_post_send_with_invalidate (
+ IN DAT_EP_HANDLE, /* ep_handle */
+ IN DAT_COUNT, /* num_segments */
+ IN DAT_LMR_TRIPLET *, /* local_iov */
+ IN DAT_DTO_COOKIE, /* user_cookie */
+ IN DAT_COMPLETION_FLAGS, /* completion_flags */
+ IN DAT_BOOLEAN, /* invalidate_flag */
+ IN DAT_RMR_CONTEXT); /* RMR context */
+
+extern DAT_RETURN DAT_API dapl_ep_get_status (
+ IN DAT_EP_HANDLE, /* ep_handle */
+ OUT DAT_EP_STATE *, /* ep_state */
+ OUT DAT_BOOLEAN *, /* in_dto_idle */
+ OUT DAT_BOOLEAN * ); /* out_dto_idle */
+
+extern DAT_RETURN DAT_API dapl_ep_free (
+ IN DAT_EP_HANDLE); /* ep_handle */
+
+extern DAT_RETURN DAT_API dapl_ep_reset (
+ IN DAT_EP_HANDLE); /* ep_handle */
+
+extern DAT_RETURN DAT_API dapl_ep_create_with_srq (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN DAT_PZ_HANDLE, /* pz_handle */
+ IN DAT_EVD_HANDLE, /* recv_evd_handle */
+ IN DAT_EVD_HANDLE, /* request_evd_handle */
+ IN DAT_EVD_HANDLE, /* connect_evd_handle */
+ IN DAT_SRQ_HANDLE, /* srq_handle */
+ IN const DAT_EP_ATTR *, /* ep_attributes */
+ OUT DAT_EP_HANDLE *); /* ep_handle */
+
+extern DAT_RETURN DAT_API dapl_ep_recv_query (
+ IN DAT_EP_HANDLE, /* ep_handle */
+ OUT DAT_COUNT *, /* nbufs_allocated */
+ OUT DAT_COUNT *); /* bufs_alloc_span */
+
+extern DAT_RETURN DAT_API dapl_ep_set_watermark (
+ IN DAT_EP_HANDLE, /* ep_handle */
+ IN DAT_COUNT, /* soft_high_watermark */
+ IN DAT_COUNT); /* hard_high_watermark */
+
+/* LMR functions */
+
+#if defined(__KERNEL__)
+extern DAT_RETURN DAT_API dapl_lmr_kcreate (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN DAT_MEM_TYPE, /* mem_type */
+ IN DAT_REGION_DESCRIPTION, /* region_description */
+ IN DAT_VLEN, /* length */
+ IN DAT_PZ_HANDLE, /* pz_handle */
+ IN DAT_MEM_PRIV_FLAGS, /* privileges */
+ IN DAT_VA_TYPE, /* va_type */
+ IN DAT_MEM_OPT, /* optimization */
+ OUT DAT_LMR_HANDLE *, /* lmr_handle */
+ OUT DAT_LMR_CONTEXT *, /* lmr_context */
+ OUT DAT_RMR_CONTEXT *, /* rmr_context */
+ OUT DAT_VLEN *, /* registered_length */
+ OUT DAT_VADDR * ); /* registered_address */
+#else
+extern DAT_RETURN DAT_API dapl_lmr_create (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN DAT_MEM_TYPE, /* mem_type */
+ IN DAT_REGION_DESCRIPTION, /* region_description */
+ IN DAT_VLEN, /* length */
+ IN DAT_PZ_HANDLE, /* pz_handle */
+ IN DAT_MEM_PRIV_FLAGS, /* privileges */
+ IN DAT_VA_TYPE, /* va_type */
+ OUT DAT_LMR_HANDLE *, /* lmr_handle */
+ OUT DAT_LMR_CONTEXT *, /* lmr_context */
+ OUT DAT_RMR_CONTEXT *, /* rmr_context */
+ OUT DAT_VLEN *, /* registered_length */
+ OUT DAT_VADDR * ); /* registered_address */
+#endif /* defined(__KERNEL__) */
+
+extern DAT_RETURN DAT_API dapl_lmr_query (
+ IN DAT_LMR_HANDLE,
+ IN DAT_LMR_PARAM_MASK,
+ OUT DAT_LMR_PARAM *);
+
+extern DAT_RETURN DAT_API dapl_lmr_free (
+ IN DAT_LMR_HANDLE);
+
+extern DAT_RETURN DAT_API dapl_lmr_sync_rdma_read (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN const DAT_LMR_TRIPLET *, /* local_segments */
+ IN DAT_VLEN); /* num_segments */
+
+extern DAT_RETURN DAT_API dapl_lmr_sync_rdma_write (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN const DAT_LMR_TRIPLET *, /* local_segments */
+ IN DAT_VLEN); /* num_segments */
+
+/* RMR Functions */
+
+extern DAT_RETURN DAT_API dapl_rmr_create (
+ IN DAT_PZ_HANDLE, /* pz_handle */
+ OUT DAT_RMR_HANDLE *); /* rmr_handle */
+
+extern DAT_RETURN DAT_API dapl_rmr_create_for_ep (
+ IN DAT_PZ_HANDLE pz_handle, /* pz_handle */
+ OUT DAT_RMR_HANDLE *rmr_handle); /* rmr_handle */
+
+extern DAT_RETURN DAT_API dapl_rmr_query (
+ IN DAT_RMR_HANDLE, /* rmr_handle */
+ IN DAT_RMR_PARAM_MASK, /* rmr_args_mask */
+ OUT DAT_RMR_PARAM *); /* rmr_args */
+
+extern DAT_RETURN DAT_API dapl_rmr_bind (
+ IN DAT_RMR_HANDLE, /* rmr_handle */
+ IN DAT_LMR_HANDLE, /* lmr_handle */
+ IN const DAT_LMR_TRIPLET *, /* lmr_triplet */
+ IN DAT_MEM_PRIV_FLAGS, /* mem_priv */
+ IN DAT_VA_TYPE, /* va_type */
+ IN DAT_EP_HANDLE, /* ep_handle */
+ IN DAT_RMR_COOKIE, /* user_cookie */
+ IN DAT_COMPLETION_FLAGS, /* completion_flags */
+ INOUT DAT_RMR_CONTEXT * ); /* context */
+
+extern DAT_RETURN DAT_API dapl_rmr_free (
+ IN DAT_RMR_HANDLE);
+
+/* PSP Functions */
+
+extern DAT_RETURN DAT_API dapl_psp_create (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN DAT_CONN_QUAL, /* conn_qual */
+ IN DAT_EVD_HANDLE, /* evd_handle */
+ IN DAT_PSP_FLAGS, /* psp_flags */
+ OUT DAT_PSP_HANDLE * ); /* psp_handle */
+
+extern DAT_RETURN DAT_API dapl_psp_create_any (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ OUT DAT_CONN_QUAL *, /* conn_qual */
+ IN DAT_EVD_HANDLE, /* evd_handle */
+ IN DAT_PSP_FLAGS, /* psp_flags */
+ OUT DAT_PSP_HANDLE *); /* psp_handle */
+
+extern DAT_RETURN DAT_API dapl_psp_query (
+ IN DAT_PSP_HANDLE,
+ IN DAT_PSP_PARAM_MASK,
+ OUT DAT_PSP_PARAM * );
+
+extern DAT_RETURN DAT_API dapl_psp_free (
+ IN DAT_PSP_HANDLE ); /* psp_handle */
+
+/* RSP Functions */
+
+extern DAT_RETURN DAT_API dapl_rsp_create (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN DAT_CONN_QUAL, /* conn_qual */
+ IN DAT_EP_HANDLE, /* ep_handle */
+ IN DAT_EVD_HANDLE, /* evd_handle */
+ OUT DAT_RSP_HANDLE * ); /* rsp_handle */
+
+extern DAT_RETURN DAT_API dapl_rsp_query (
+ IN DAT_RSP_HANDLE,
+ IN DAT_RSP_PARAM_MASK,
+ OUT DAT_RSP_PARAM * );
+
+extern DAT_RETURN DAT_API dapl_rsp_free (
+ IN DAT_RSP_HANDLE ); /* rsp_handle */
+
+/* PZ Functions */
+
+extern DAT_RETURN DAT_API dapl_pz_create (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ OUT DAT_PZ_HANDLE * ); /* pz_handle */
+
+extern DAT_RETURN DAT_API dapl_pz_query (
+ IN DAT_PZ_HANDLE, /* pz_handle */
+ IN DAT_PZ_PARAM_MASK, /* pz_args_mask */
+ OUT DAT_PZ_PARAM * ); /* pz_args */
+
+extern DAT_RETURN DAT_API dapl_pz_free (
+ IN DAT_PZ_HANDLE ); /* pz_handle */
+
+/* SRQ functions */
+
+extern DAT_RETURN DAT_API dapl_srq_create (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN DAT_PZ_HANDLE, /* pz_handle */
+ IN DAT_SRQ_ATTR *, /* srq_attr */
+ OUT DAT_SRQ_HANDLE *); /* srq_handle */
+
+extern DAT_RETURN DAT_API dapl_srq_free (
+ IN DAT_SRQ_HANDLE); /* srq_handle */
+
+extern DAT_RETURN DAT_API dapl_srq_post_recv (
+ IN DAT_SRQ_HANDLE, /* srq_handle */
+ IN DAT_COUNT, /* num_segments */
+ IN DAT_LMR_TRIPLET *, /* local_iov */
+ IN DAT_DTO_COOKIE); /* user_cookie */
+
+extern DAT_RETURN DAT_API dapl_srq_query (
+ IN DAT_SRQ_HANDLE, /* srq_handle */
+ IN DAT_SRQ_PARAM_MASK, /* srq_param_mask */
+ OUT DAT_SRQ_PARAM *); /* srq_param */
+
+extern DAT_RETURN DAT_API dapl_srq_resize (
+ IN DAT_SRQ_HANDLE, /* srq_handle */
+ IN DAT_COUNT); /* srq_max_recv_dto */
+
+extern DAT_RETURN DAT_API dapl_srq_set_lw (
+ IN DAT_SRQ_HANDLE, /* srq_handle */
+ IN DAT_COUNT); /* low_watermark */
+
+/* CSP functions */
+extern DAT_RETURN DAT_API dapl_csp_create (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN DAT_COMM *, /* communicator */
+ IN DAT_IA_ADDRESS_PTR, /* address */
+ IN DAT_EVD_HANDLE, /* evd_handle */
+ OUT DAT_CSP_HANDLE *); /* csp_handle */
+
+extern DAT_RETURN DAT_API dapl_csp_query (
+ IN DAT_CSP_HANDLE, /* csp_handle */
+ IN DAT_CSP_PARAM_MASK, /* csp_param_mask */
+ OUT DAT_CSP_PARAM *); /* csp_param */
+
+extern DAT_RETURN DAT_API dapl_csp_free (
+ IN DAT_CSP_HANDLE); /* csp_handle */
+
+/* HA functions */
+DAT_RETURN DAT_API dapl_ia_ha (
+ IN DAT_IA_HANDLE, /* ia_handle */
+ IN const DAT_NAME_PTR, /* provider */
+ OUT DAT_BOOLEAN *); /* answer */
+
+#ifdef DAT_EXTENSIONS
+#include <stdarg.h>
+extern DAT_RETURN DAT_API dapl_extensions (
+ IN DAT_HANDLE, /* handle */
+ IN DAT_EXTENDED_OP, /* extended op */
+ IN va_list); /* argument list */
+#endif
+
+/*
+ * DAPL internal utility function prototpyes
+ */
+
+extern void dapl_llist_init_head (
+ DAPL_LLIST_HEAD * head);
+
+extern void dapl_llist_init_entry (
+ DAPL_LLIST_ENTRY * entry);
+
+extern DAT_BOOLEAN dapl_llist_is_empty (
+ DAPL_LLIST_HEAD * head);
+
+extern void dapl_llist_add_head (
+ DAPL_LLIST_HEAD * head,
+ DAPL_LLIST_ENTRY * entry,
+ void * data);
+
+extern void dapl_llist_add_tail (
+ DAPL_LLIST_HEAD * head,
+ DAPL_LLIST_ENTRY * entry,
+ void * data);
+
+extern void dapl_llist_add_entry (
+ DAPL_LLIST_HEAD * head,
+ DAPL_LLIST_ENTRY * entry,
+ DAPL_LLIST_ENTRY * new_entry,
+ void * data);
+
+extern void * dapl_llist_remove_head (
+ DAPL_LLIST_HEAD * head);
+
+extern void * dapl_llist_remove_tail (
+ DAPL_LLIST_HEAD * head);
+
+extern void * dapl_llist_remove_entry (
+ DAPL_LLIST_HEAD * head,
+ DAPL_LLIST_ENTRY * entry);
+
+extern void * dapl_llist_peek_head (
+ DAPL_LLIST_HEAD * head);
+
+extern void * dapl_llist_next_entry (
+ IN DAPL_LLIST_HEAD *head,
+ IN DAPL_LLIST_ENTRY *cur_ent);
+
+extern void dapl_llist_debug_print_list (
+ DAPL_LLIST_HEAD * head);
+
+
+#endif