/*
* 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-2003, Network Appliance, Inc. All rights reserved.
*/
/*
*/
/*
*
* HEADER: dapl.h
*
* PURPOSE: defines common data structures for the DAPL reference implemenation
*
* Description: This file describes the working data structures used within
* DAPL RI.
*
*/
#ifndef _DAPL_H_
#define _DAPL_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/byteorder.h>
#include <dat/dat_registry.h>
#include "dapl_osd.h"
#include "dapl_debug.h"
#include "dapl_tavor_ibtf.h"
/*
* The HTOBE_xx() macro converts data from host order to big endian
* order and hence uses the BE_xx macros to do the byte swapping.
*
* The BETOH_xx() macro converts data from big endian order to host
* order. This is used when data is read from CQs or QPs. Due to the
* self-inversing nature of byte swapping routines BE_xx macros have
* the effect of converting big endian to host byte order which can
* be big endian or little endian.
* eg. On i386 BE_64(val64_be) = val64_le
* On sparc BE_64(val64_be) = val64_be.
*
* Tavor is a big endian device, all the buffer manipulation for
* QPs, CQs and the doorbell page needs to be aware of this.
*
*/
/* use inline code to get performance of bswap* instructions */
/* use GNU inline */
/* works for both i386 and amd64 */
{
return (value);
}
#if defined(__amd64)
{
return (value);
}
#else /* defined(__i386) */
{
union {
struct { uint32_t a, b; } s;
uint64_t u;
} v;
v.u = value;
__asm__("bswap %0 ; bswap %1 ; xchgl %0,%1"
: "=r" (v.s.a), "=r" (v.s.b)
: "0" (v.s.a), "1" (v.s.b));
return (v.u);
}
#endif
#else /* !defined(__lint) && defined(__GNUC__) */
/* use SUN inline with .il files */
#endif /* !defined(__lint) && defined(__GNUC__) */
#else /* defined(__amd64) || defined(__i386) */
/* These are identity (do nothing) on big-endian machines. */
#endif /* defined(__amd64) || defined(__i386) */
/*
*
* Enumerations
*
*/
typedef enum dapl_magic {
/* magic number values for verification & debug */
} DAPL_MAGIC;
typedef enum dapl_evd_state {
typedef enum dapl_evd_completion {
typedef enum dapl_cno_state {
typedef enum dapl_qp_state {
/*
*
* Constants
*
*/
/*
* number of HCAs allowed
*/
/*
* Configures the RMR bind evd restriction
*/
/*
* special qp_state indicating the EP does not have a QP attached yet
*/
/*
*
* Macros
*
*/
/*
* Simple macro to verify a handle is bad.
* - pointer's magic number is wrong
* - both pointer is NULL and not word aligned checked by the registry
*/
#define DAPL_MIN(a, b) (((a) < (b)) ? (a) : (b))
#define DAPL_MAX(a, b) (((a) > (b)) ? (a) : (b))
/*
*
* Typedefs
*
*/
typedef void *DAPL_HASH_DATA;
IN const void *,
/*
*
* Structures
*
*/
struct dapl_llist_entry {
void *data;
};
struct dapl_ring_buffer {
};
struct dapl_cookie_buffer {
};
typedef DAT_RETURN
struct dapl_hca {
/* Values specific to IB OS API */
int max_inline_send;
/* CQ support thread */
/* Memory Subsystem Support */
/* Limits & useful HCA attributes */
int hermon_resize_cq;
};
extern void dapls_init_funcs_tavor(DAPL_HCA *);
extern void dapls_init_funcs_arbel(DAPL_HCA *);
extern void dapls_init_funcs_hermon(DAPL_HCA *);
/* DAPL Objects always have the following header */
struct dapl_header {
};
enum DAPL_IA_FLAGS {
};
/* DAPL_IA maps to DAT_IA_HANDLE */
struct dapl_ia {
};
/* DAPL_CNO maps to DAT_CNO_HANDLE */
struct dapl_cno {
/* A CNO cannot be freed while it is referenced elsewhere. */
};
/* DAPL_EVD maps to DAT_EVD_HANDLE */
struct dapl_evd {
/* Derived from evd_flags; see dapls_evd_internal_create. */
/* Every EVD has a CQ unless it is a SOFTWARE_EVENT only EVD */
/*
* Mellanox Specific completion handle for
*/
/*
* An Event Dispatcher cannot be freed while
* it is referenced elsewhere.
*/
/* Set if there has been a catastrophic overflow */
/* the actual events */
/*
* 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.
*/
};
/* DAPL_EP maps to DAT_EP_HANDLE */
struct dapl_ep {
/* What the DAT Consumer asked for */
/* The RC Queue Pair (IBM OS API) */
/* communications manager handle (IBM OS API) */
/*
* store the remote IA address here, reference from the param
* struct which only has a pointer, no storage
*/
/* For passive connections we maintain a back pointer to the CR */
void *cr_ptr;
/* private data container */
/* DTO data */
};
/* DAPL_PZ maps to DAT_PZ_HANDLE */
struct dapl_pz {
};
/* DAPL_LMR maps to DAT_LMR_HANDLE */
struct dapl_lmr {
};
/* DAPL_RMR maps to DAT_RMR_HANDLE */
struct dapl_rmr {
};
/* SP types, indicating the state and queue */
typedef enum dapl_sp_state {
/* DAPL_SP maps to DAT_PSP_HANDLE and DAT_RSP_HANDLE */
struct dapl_sp {
/* maintenence fields */
};
/* DAPL_CR maps to DAT_CR_HANDLE */
struct dapl_cr {
/*
* 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.
*/
/* IB specific fields */
/*
* Assuming that the maximum private data size is small.
* If it gets large, use of a pointer may be appropriate.
*/
/*
* Need to be able to associate the CR back to the PSP for
* dapl_cr_reject.
*/
};
/* DAPL_SRQ maps to DAT_SRQ_HANDLE */
struct dapl_srq {
/* SRQ cannot be freed till EPs attached to srq are freed */
/* DTO data */
};
typedef enum dapl_dto_type {
typedef enum dapl_cookie_type {
/* DAPL_DTO_COOKIE used as context for DTO WQEs */
struct dapl_dto_cookie {
};
/* DAPL_RMR_COOKIE used as context for bind WQEs */
struct dapl_rmr_cookie {
};
typedef enum dapl_cookie_queue_type {
/* DAPL_COOKIE used as context for WQEs */
struct dapl_cookie {
union {
void *ptr;
} queue;
union {
} val;
};
/*
* Generic HCA name field
*/
#if defined(IBHOSTS_NAMING)
/*
* Simple mapping table to match IP addresses to GIDs. Loaded
* by dapl_init.
*/
typedef struct _dapl_gid_map_table {
} DAPL_GID_MAP;
#endif /* IBHOSTS_NAMING */
/*
*
* Function Prototypes
*
*/
/*
* DAT Mandated functions
*/
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
/* helper functions */
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
OUT DAT_HANDLE_TYPE *);
/* CNO functions */
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
/* CR Functions */
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
/* EVD Functions */
extern DAT_RETURN
extern DAT_RETURN
#if 0 /* kdapl */
extern DAT_RETURN
#else
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
#endif
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
DAT_EVD_HANDLE, /* evd_handle */
const DAT_EVENT *); /* event */
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
/* EP functions */
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
/* LMR functions */
extern DAT_RETURN
extern DAT_RETURN
OUT DAT_LMR_PARAM *);
extern DAT_RETURN
/* RMR Functions */
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
/* PSP Functions */
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
OUT DAT_PSP_PARAM *);
extern DAT_RETURN
/* RSP Functions */
extern DAT_RETURN
extern DAT_RETURN
OUT DAT_RSP_PARAM *);
extern DAT_RETURN
/* PZ Functions */
extern DAT_RETURN
extern DAT_RETURN
extern DAT_RETURN
/* Non-coherent memory fucntions */
extern DAT_RETURN dapl_lmr_sync_rdma_read(
extern DAT_RETURN dapl_lmr_sync_rdma_write(
/*
* SRQ functions
*/
extern DAT_RETURN dapl_ep_create_with_srq(
extern DAT_RETURN dapl_ep_recv_query(
extern DAT_RETURN dapl_ep_set_watermark(
extern DAT_RETURN dapl_srq_create(
extern DAT_RETURN dapl_srq_free(
extern DAT_RETURN dapl_srq_post_recv(
extern DAT_RETURN dapl_srq_query(
extern DAT_RETURN dapl_srq_resize(
extern DAT_RETURN dapl_srq_set_lw(
/*
* DAPL internal utility function prototpyes
*/
extern void
extern void
extern DAT_BOOLEAN
extern void
void *data);
extern void
void *data);
extern void
void *data);
extern void *
extern void *
extern void *
extern void *
extern void *
extern void
#ifdef __cplusplus
}
#endif
#endif /* _DAPL_H_ */