/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2002-2004, Network Appliance, Inc. All rights reserved.
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _DAT_H_
#define _DAT_H_
/*
*
* HEADER: dat.h
*
* PURPOSE: defines the common DAT API for uDAPL and kDAPL.
*
* Description: Header file for "uDAPL: User Direct Access Programming
* Library, Version: 1.2"
*
* Mapping rules:
* All global symbols are prepended with "DAT_" or "dat_"
* All DAT objects have an 'api' tag which, such as 'ep' or 'lmr'
* The method table is in the provider definition structure.
*
*
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <dat/dat_error.h>
/* Generic DAT types */
/*
* Used for provider, vendor, transport, hardware specific attributes
* definitions.
*/
typedef struct dat_named_attr {
typedef enum dat_boolean {
DAT_FALSE = 0,
} DAT_BOOLEAN;
typedef union dat_context {
} DAT_CONTEXT;
typedef enum dat_completion_flags {
/* Completes with notification */
/* Completions suppressed if successful */
/* Sender controlled notification for recv completion */
/* Completions with unsignaled notifications */
/* Do not start processing until all previous RDMA reads complete. */
/*
* Only valid for uDAPL as EP attribute for Recv Completion flags.
* Waiter unblocking is controlled by Threshold value of dat_evd_wait.
* UNSIGNALLED for RECV not allowed when EP has this attribute
*/
/* timeout = infinity */
/* dat handles */
/* dat NULL handles */
/* QOS definitions */
typedef enum dat_qos {
/* not low latency, nor high throughput */
/* both low latency and high throughput */
} DAT_QOS;
/*
* FLAGS
*/
typedef enum dat_connect_flags {
typedef enum dat_close_flags {
typedef enum dat_evd_flags {
/* DAT events only, no software events */
typedef enum dat_psp_flags {
/*
* Memory Buffers
*
* Both LMR and RMR triplets specify 64-bit addresses in the local host's byte
* order, even when that exceeds the size of a DAT_PVOID for the host
* architecture.
*/
/*
* Both LMR and RMR Triplets specify 64-bit addresses in the local host
* order, even when that exceeds the size of a void pointer for the host
* architecture. The DAT_VADDR type that represents addresses is in the
* native byte-order of the local host. Helper macros that allow Consumers
* to convert DAT_VADDR into various orders that might be useful for
* inclusion of RMR Triplets into a payload of a message follow.
*
* DAT defines the following macros to convert the fields on an RMR Triplet
* to defined byte orders to allow their export by the Consumer over wire
* protocols. DAT does not define how the two peers decide which byte should be
* used.
*
* DAT_LMRC_TO_LSB(lmrc) returns the supplied LMR Context in ls-byte
* order.
* DAT_LMRC_TO_MSB(lmrc) returns the supplied LMR Context in ms-byte
* order.
* DAT_RMRC_TO_LSB(rmrc) returns the supplied RMR Context in ls-byte
* order.
* DAT_RMRC_TO_MSB(rmrc) returns the supplied RMR Context in ms-byte
* order.
* DAT_VADDR_TO_LSB(vaddr) returns the supplied Virtual Address in ls-byte
* order.
* DAT_VADDR_TO_MSB(vaddr) returns the supplied Virtual Address in
* ms-byte order.
* DAT_VLEN_TO_LSB(vlen) returns the supplied length in ls-byte order.
* DAT_VLEN_TO_MSB(vlen) returns the supplied length in ms-byte order.
*
* Consumers are free to use 64-bit or 32-bit arithmetic for local or remote
* memory address and length manipulation in their preferred byte-order. Only
* the LMR and RMR Triplets passed to a Provider as part of a Posted DTO are
* required to be in 64-bit address and local host order formats. Providers
* shall convert RMR_Triplets to a Transport-required wire format.
*
* For the best performance, Consumers should align each buffer segment to
* the boundary specified by the dat_optimal_alignment.
*/
/*
* It is legal for Consumer to specify zero for segment_length
* of the dat_lmr_triplet. When 0 is specified for the
* segment_length then the other two elements of the
* dat_lmr_triplet are irrelevant and can be invalid.
*/
typedef struct dat_lmr_triplet {
typedef struct dat_rmr_triplet {
/*
* The extra padding ensures that context, address, and length parameters are
* aligned on 64-bit boundaries.
*/
/* Memory privileges */
typedef enum dat_mem_priv_flags {
/*
* For backwards compatibility with DAT-1.0 memory privileges values
* are supported
*/
/* LMR Arguments Mask */
typedef enum dat_lmr_param_mask {
/* RMR Argumments & RMR Arguments Mask */
typedef struct dat_rmr_param {
typedef enum dat_rmr_param_mask {
/* Provider attributes */
typedef enum dat_iov_ownership {
/* Not modification by provider, consumer can use anytime. */
/* Provider does not modify returned IOV DTO on completion. */
/* Provider may modify IOV DTO on completion, can't trust it. */
typedef enum dat_ep_creator_for_psp {
/* General Interface Adapter attributes. These apply to both udat and kdat. */
/* To support backwards compatibility for DAPL-1.0 */
/* to support backwards compatibility for DAPL-1.0 & DAPL-1.1 */
typedef struct dat_ia_attr
{
} DAT_IA_ATTR;
/* To support backwards compatibility for DAPL-1.0 & DAPL-1.1 */
UINT64_C(0x020000000)
UINT64_C(0x040000000)
/* To support backwards compatibility for DAPL-1.0 & DAPL-1.1 */
/* Endpoint attributes */
typedef enum dat_service_type {
typedef struct dat_ep_attr {
} DAT_EP_ATTR;
/* Endpoint Parameters */
/* For backwards compatability */
typedef enum dat_ep_state {
} DAT_EP_STATE;
typedef struct dat_ep_param {
} DAT_EP_PARAM;
/* Remainder of values from EP_ATTR, 0x00001000 and up */
typedef enum dat_srq_state {
typedef struct dat_srq_attr {
} DAT_SRQ_ATTR;
typedef struct dat_srq_param {
typedef enum dat_srq_param_mask {
/* PZ Parameters */
typedef struct dat_pz_param {
} DAT_PZ_PARAM;
typedef enum dat_pz_param_mask {
/* PSP Parameters */
typedef struct dat_psp_param {
typedef enum dat_psp_param_mask {
/* RSP Parameters */
typedef struct dat_rsp_param {
typedef enum dat_rsp_param_mask {
/*
* Connection Request Parameters.
*
* The Connection Request does not provide Remote Endpoint attributes.
* If a local Consumer needs this information, the remote Consumer should
* encode it into Private Data.
*/
typedef struct dat_cr_param {
/* Remote IA whose Endpoint requested the connection. */
/* Port qualifier of the remote Endpoint of the requested connection. */
/* Size of the Private Data. */
/*
* Pointer to the Private Data passed by remote side in the Connection
* Request.
*/
/*
* The local Endpoint provided by the Service Point for the requested
* connection. It is the only Endpoint that can accept a Connection
* Request on this Service Point. The value DAT_HANDLE_NULL represents
* that there is no associated local Endpoint for the requested
* connection.
*/
} DAT_CR_PARAM;
typedef enum dat_cr_param_mask {
/*
* *********************** Events *****************************************
*/
/* Completion status flags */
/* dto completion status */
/* For backwards compatability */
typedef enum dat_dto_completion_status {
DAT_DTO_SUCCESS = 0,
/* RMR completion status */
/* For backwards compatability */
/* Completion group structs (six total) */
/* DTO completion event data */
/* transferred_length is not defined if status is not DAT_SUCCESS */
typedef struct dat_dto_completion_event_data {
/* RMR bind completion event data */
typedef struct dat_rmr_bind_completion_event_data {
typedef union dat_sp_handle {
/* Connection Request Arrival event data */
typedef struct dat_cr_arrival_event_data {
/*
* Handle to the Service Point that received the Connection Request
* from the remote side. If the Service Point was Reserved, sp is
* DAT_HANDLE_NULL because the reserved Service Point is automatically
* destroyed upon generating this event. Can be PSP or RSP.
*/
/* Address of the IA on which the Connection Request arrived. */
/*
* Connection Qualifier of the IA on which the Service Point received a
* Connection Request.
*/
/*
* The Connection Request instance created by a Provider for the
* arrived Connection Request. Consumers can find out private_data
* passed by a remote Consumer from cr_handle. It is up to a Consumer
* to dat_cr_accept or dat_cr_reject of the Connection Request.
*/
/* Connection event data */
typedef struct dat_connection_event_data {
/* Async Error event data */
/*
* For unaffiliated asynchronous event dat_handle is ia_handle. For Endpoint
* affiliated asynchronous event dat_handle is ep_handle. For EVD affiliated
* asynchronous event dat_handle is evd_handle. For SRQ affiliated asynchronous
* event dat_handle is srq_handle. For Memory affiliated asynchronous event
* dat_handle is either lmr_handle, rmr_handle or pz_handle.
*/
typedef struct dat_asynch_error_event_data {
/* LMR, RMR, or PZ handle */
/* The reason is object type specific and its values are defined below */
typedef enum ia_async_error_reason {
typedef enum ep_async_error_reason {
typedef enum ep_evd_error_reason {
typedef enum ep_srq_error_reason {
typedef enum lmr_async_error_reason {
typedef enum rmr_async_error_reason {
typedef enum pz_async_error_reason {
/* Software event data */
typedef struct dat_software_event_data {
typedef enum dat_event_number {
/* Union for event Data */
typedef union dat_event_data {
/* Event struct that holds all event information */
typedef struct dat_event {
} DAT_EVENT;
/* Provider/registration info */
typedef struct dat_provider_info {
/*
* FUNCTION PROTOTYPES
*/
/*
* IA functions
*
* Note that there are actual 'dat_ia_open' and 'dat_ia_close'
* functions, it is not just a re-directing #define. That is
* because the functions may have to ensure that the provider
* library is loaded before it can call it, and may choose to
* unload the library after the last close.
*/
extern DAT_RETURN dat_ia_openv(
extern DAT_RETURN dat_ia_query(
extern DAT_RETURN dat_ia_close(
/* helper functions */
extern DAT_RETURN dat_set_consumer_context(
extern DAT_RETURN dat_get_consumer_context(
extern DAT_RETURN dat_get_handle_type(
/* CR Functions */
extern DAT_RETURN dat_cr_query(
extern DAT_RETURN dat_cr_accept(
extern DAT_RETURN dat_cr_reject(
/*
* For DAT-1.1 and above, this function is defined for both uDAPL and kDAPL.
* For DAT-1.0 it was only defined for uDAPL.
*/
extern DAT_RETURN dat_cr_handoff(
/* EVD Functions */
extern DAT_RETURN dat_evd_resize(
extern DAT_RETURN dat_evd_post_se(
extern DAT_RETURN dat_evd_dequeue(
extern DAT_RETURN dat_evd_query(
extern DAT_RETURN dat_evd_free(
/* EP functions */
extern DAT_RETURN dat_ep_create(
extern DAT_RETURN dat_ep_query(
extern DAT_RETURN dat_ep_modify(
extern DAT_RETURN dat_ep_connect(
extern DAT_RETURN dat_ep_dup_connect(
extern DAT_RETURN dat_ep_disconnect(
extern DAT_RETURN dat_ep_post_send(
extern DAT_RETURN dat_ep_post_recv(
extern DAT_RETURN dat_ep_post_rdma_read(
extern DAT_RETURN dat_ep_post_rdma_write(
extern DAT_RETURN dat_ep_get_status(
extern DAT_RETURN dat_ep_free(
extern DAT_RETURN dat_ep_reset(
/* LMR functions */
extern DAT_RETURN dat_lmr_query(
extern DAT_RETURN dat_lmr_free(
/* Non-coherent memory functions */
extern DAT_RETURN dat_lmr_sync_rdma_read(
extern DAT_RETURN dat_lmr_sync_rdma_write(
/* RMR Functions */
extern DAT_RETURN dat_rmr_create(
extern DAT_RETURN dat_rmr_query(
extern DAT_RETURN dat_rmr_bind(
extern DAT_RETURN dat_rmr_free(
/* PSP Functions */
extern DAT_RETURN dat_psp_create(
extern DAT_RETURN dat_psp_create_any(
extern DAT_RETURN dat_psp_query(
extern DAT_RETURN dat_psp_free(
/* RSP Functions */
extern DAT_RETURN dat_rsp_create(
extern DAT_RETURN dat_rsp_query(
extern DAT_RETURN dat_rsp_free(
/* PZ Functions */
extern DAT_RETURN dat_pz_create(
extern DAT_RETURN dat_pz_query(
extern DAT_RETURN dat_pz_free(
/*
* SRQ functions
*/
extern DAT_RETURN dat_ep_create_with_srq(
extern DAT_RETURN dat_ep_recv_query(
extern DAT_RETURN dat_ep_set_watermark(
extern DAT_RETURN dat_srq_create(
extern DAT_RETURN dat_srq_free(
extern DAT_RETURN dat_srq_post_recv(
extern DAT_RETURN dat_srq_query(
extern DAT_RETURN dat_srq_resize(
extern DAT_RETURN dat_srq_set_lw(
/*
* DAT registry functions.
*
* Note the dat_ia_open and dat_ia_close functions are linked to
* registration code which "redirects" to the appropriate provider.
*/
/* dat_provider_list */
/*
* DAT error functions.
*/
extern DAT_RETURN dat_strerror(
OUT const char **, /* major message string */
OUT const char **); /* minor message string */
#ifdef __cplusplus
}
#endif
#endif /* _DAT_H_ */